﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharp.Study.Test
{
    public class ref关键字理解
    {
        public static void Go()
        {
            //值类型
            int a = 666;
            string b = "666";
            //引用类型
            var list = new List<int> { 1, 2, 3 };

            //ChangeValue(a, b, list);
            ChangeValueRef(ref a, ref b, ref list);
        }

        public static void ChangeValue(int a, string b, List<int> list)
        {
            a = 777;
            b = "777";
            list.Add(4);
            list.Add(5);
        }

        public static void ChangeValueRef(ref int a, ref string b, ref List<int> list)
        {
            a = 777;
            b = "777";
            list.Add(4);
            list.Add(5);
        }
    }
}
